Add file chooser support in watch app settings on Android#197
Open
jwlarocque wants to merge 1 commit into
Open
Add file chooser support in watch app settings on Android#197jwlarocque wants to merge 1 commit into
jwlarocque wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On iOS WKWebView supports file input out of the box, but on Android onShowFileChooser does nothing by default. As a result there is a disparity in watch app settings capability (this disparity existed in the original Pebble app as well).
This PR overrides onShowFileChooser in an AccompanistWebChromeClient passed to the WebView's platformWebViewParams in order to launch the system file chooser. On iOS it passes null, the default, to retain current behavior.
Tested on Pixel 7 running Android 16 (with a watch app that uses <input type="file"> in a custom Clay component). I do not have a Mac/iOS device to build and test the iOS version; should be no change but if anyone with a Mac is able to confirm that would be fantastic.